﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace MessageBox
{
    /// <summary>
    /// Unique point d'entré pour afficher une message box.
    /// </summary>
    public class ShowMessageBox
    {
        public static ImageSource Icon
        {
            get;
            private set;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="typeWindow"></param>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static TYPE_RESULT_BOX Show(TYPE_WINDOW_BOX typeWindow, String title, String message)
        {
            BoxMessage boxMessage = null;

            if (Icon != null)
                boxMessage.Icon = Icon;

            TYPE_RESULT_BOX typResult;

            switch (typeWindow)
            {
                case TYPE_WINDOW_BOX.INFO:
                    boxMessage = new BoxMessageInformation(title, message);
                    break;

                case TYPE_WINDOW_BOX.AVERTISSEMENT:
                    boxMessage = new BoxMessageAvertissement(title, message);
                    break;

                case TYPE_WINDOW_BOX.ERREUR:
                    boxMessage = new BoxMessageErreur(title, message);
                    break;

                case TYPE_WINDOW_BOX.CONFIRM:
                    boxMessage = new BoxMessageConfirmation(title, message);
                    break;

                default:
                    typResult = TYPE_RESULT_BOX.KO;
                    return typResult;
            }

            typResult = boxMessage.ShowScreen();
            return typResult;
        }

        public static TYPE_RESULT_BOX Show(TYPE_WINDOW_BOX typeWindow, String title, String message, ImageSource icon)
        {
            Icon = icon;
            return Show(typeWindow, title, message);
        }
    }
}
